package com.zjm.find.service.impl;

import com.zjm.find.dao.MomentMapper;
import com.zjm.find.dao.StrategyMapper;
import com.zjm.find.dao.UserCollectionMapper;
import com.zjm.find.pojo.Moment;
import com.zjm.find.pojo.Strategy;
import com.zjm.find.pojo.UserCollection;
import com.zjm.find.service.MomentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MomentServiceImpl implements MomentService {

    @Autowired
    private MomentMapper momentMapper;


    @Autowired
    private StrategyMapper strategyMapper;

    @Autowired
    private UserCollectionMapper userCollectionMapper;

    @Override
    public List<Moment> getMoment(Integer uid) {
        return momentMapper.getMoment(uid);
    }

    @Override
    public List<Strategy> getStrategy(Strategy strategy) {
        return strategyMapper.getStrategy(strategy);
    }

    @Override
    public boolean createMoment(Moment moment) {
        return momentMapper.createMoment(moment) == 1 ? true : false;
    }

    @Override
    public boolean updateStrategy(Strategy strategy) {
        return strategyMapper.updateStrategy(strategy) == 1 ? true : false;
    }

    @Override
    public boolean deleteStrategy(Strategy strategy) {
        return strategyMapper.deleteStrategy(strategy) == 1 ? true : false;
    }

    @Override
    public boolean deleteMoment(String mid) {
        return momentMapper.deleteMoment(mid) == 1 ? true : false;
    }

    @Override
    public boolean createStrategy(Strategy strategy) {
        return strategyMapper.createStrategy(strategy) == 1 ? true : false;
    }

    @Override
    public boolean createCollection(UserCollection userCollection) {
        return userCollectionMapper.createCollection(userCollection) == 1 ? true : false;
    }

    @Override
    public boolean cancelCollection(UserCollection userCollection) {
        return userCollectionMapper.cancelCollection(userCollection) == 1 ? true : false;
    }

    @Override
    public List<UserCollection> selectCollection(UserCollection userCollection) {
        return userCollectionMapper.selectCollection(userCollection);
    }

    @Override
    public List<Strategy> selectUserCollection(Strategy strategy) {
        return strategyMapper.selectUserCollection(strategy);
    }

    @Override
    public List selectUserHistory(Strategy strategy) {
        return strategyMapper.selectUserHistory(strategy);
    }

    @Override
    public List getTabs() {
        return strategyMapper.getTaps();
    }
}
